<html xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<head>
    <title>通用字典列表</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src="../../static/bootstrap/js/jquery-3.4.1.min.js" type="text/javascript"></script>
    <script src="../../static/bootstrap/js/static-resources.js"></script>
    <style>
        .dbox{
            padding:8px 0px 15px 8px;
            margin-left: 20px;
            border: 1px solid #b2d5e7;
            box-shadow: -2px -2px 2px 2px #ccc,2px 2px 2px 2px #ccc;
            blur:1px;
        }
        .badge{
            width: 285px;
        }
    </style>
<script type="text/javascript">
    $(function () {
        $(".footerPage").load("../footer.html");
        let DEFAULT_DATA_MODEL = {
            "subsCode":"",
            "subsName":"",            
            "subsDataDate":"",
            "hpError":"",
            "hpInService":"",
            "hpFinish":"",
            "hpDayBatch":"",
            "hpNightBatch":"",
            "hpTimeTask":"",
        };
        new Vue({
            el : '#app',
            mixins: [window.$DEFAULT_MIXIN],
            data: {
                queryParam: {
                },
                pageInfo: {
                    page: 1,
                    size: 10,
                    total: 0
                },
                list:[],
                sAgentInfoList:[],
                selected: null,
                show: false,
                readonly: false,
                loading: false,
                modelTitle:"",
                dataObj: {},
                opType: "",
            },
            watch:{
                opType(val, old){
                    if (val == "add") {
                        this.modelTitle = "通用字典新增";
                        this.show = true;
                        this.readonly = false;
                        this.dataObj = $.extend({}, DEFAULT_DATA_MODEL);
                    } else if (val == "update") {
                        this.modelTitle = "通用字典修改";
                        this.show = true;
                        this.readonly = false;
                        this.dataObj = $.extend({}, this.selected);
                    } else if (val == "view") {
                        this.modelTitle = "通用字典详情";
                        this.show = true;
                        this.readonly = true;
                        this.dataObj = $.extend({}, this.selected);
                    }
                }
            },
            computed:{
                USER_STATUS(){
                    return USER_STATUS;
                },
                paths(){
                    return [
                        {text: '首页', href: '/index.html'},
                        {text: '系统设置', href: '#'},
                        {text: '系统基本信息', href: '#'},
                        {text: '通用字典列表', href: 'batch-console/SDicList.html'},
                    ]
                },
                fields(){
                    return [
                        {key:"subsCode", label:"系统代码", sortable:false},
                        {key:"subsName", label:"系统名称", sortable:false},
                        {key:"subsDataDate", label:"系统日期", sortable:false},
                        {key:"hpError", label:"出错", sortable:false},
                        {key:"hpInService", label:"运行", sortable:false},
                        {key:"hpFinish", label:"完成", sortable:false},
                        {key:"hpDayBatch", label:"日间批次", sortable:false},
                        {key:"hpNightBatch", label:"夜间批次", sortable:false},
                        {key:"hpTimeTask", label:"定时任务", sortable:false},
                    ]
                },
            },
            methods:{
                onRowSelected(items){
                    this.selected = items[0];
                },
                submitQry(page){
                    if (page == true) {
                        this.pageInfo.page = 1;
                    }
                    let self = this;
                    
                    JLEUtil.requestForm("api/batch/home/pages", "POST", null, $.extend({}, self.queryParam, self.pageInfo),
                      function(data, textStatus, jqXHR){
                            self.list = data.rows;  
							self.pageInfo.total = data.total;
                        },
                        function(jqXHR, textStatus, errorThrown){
                        });
                    JLEUtil.requestForm("api/s/agent/infos", "POST", null, $.extend({}, self.queryParam, self.pageInfo),
                        function(data, textStatus, jqXHR){
                            self.sAgentInfoList = data.rows;
                        },
                        function(jqXHR, textStatus, errorThrown){
                        });
                },
                closeModel(){
                    this.show = false;
                    this.modelData = {};
                    this.opType = "";
                }
            },
            mounted(){
                this.submitQry(true);
            }
        })
    });

</script>
</head>
<body>
<div class="headerPage"></div>
<div id="app">
    <div class="container-fluid mt-1">
        <div>
            <h1 style="margin-left: 15px;"><b-badge class="badge">业务系统：{{this.list.length}} 个</b-badge></h1>
        </div>
        <div class="dbox" >
        <div style="margin-left: 15px">
            <b-card-group deck >
                <b-card
                        no-body
                        v-for="item in list"
                        border-variant="success"
                        header-bg-variant="success"
                        header-text-variant="white"
                        style="max-width: 16rem;min-width: 16rem"
                        :header="item.subsName"
                        v-if="item.hpError == 0"
                        class="text-center mt-2">
                    <b-table-simple  small  >
                        <b-tbody>
                            <b-tr>
                                <b-th rowspan="3">日间批次：{{item.batchNumber}}</b-th>
                                <b-th class="text-right"  >已完成：</b-th>
                                <b-td >{{item.hpFinish}}</b-td>
                            </b-tr>
                            <b-tr>
                                <b-th class="text-right" >执行中：</b-th>
                                <b-td >{{item.hpRunning}}</b-td>
                            </b-tr>
                            <b-tr>
                                <b-th class="text-right" >异&nbsp;&nbsp;&nbsp;&nbsp;常：</b-th>
                                <b-td >{{item.hpError}}</b-td>
                            </b-tr>
                        </b-tbody>
                    </b-table-simple>
                </b-card>
                <b-card
                        no-body
                        border-variant="danger"
                        header-bg-variant="danger"
                        header-text-variant="white"
                        style="max-width: 16rem;min-width: 16rem"
                        :header="item.subsName"
                        v-else-if="item.hpError > 0"
                        class="text-center mt-2">
                    <b-table-simple  small  >
                        <b-tbody>
                            <b-tr>
                                <b-th rowspan="3">日间批次：{{item.batchNumber}}</b-th>
                                <b-th class="text-right"  >已完成：</b-th>
                                <b-td >{{item.hpFinish}}</b-td>
                            </b-tr>
                            <b-tr>
                                <b-th class="text-right" >执行中：</b-th>
                                <b-td >{{item.hpRunning}}</b-td>
                            </b-tr>
                            <b-tr>
                                <b-th class="text-right" >异&nbsp;&nbsp;&nbsp;&nbsp;常：</b-th>
                                <b-td >{{item.hpError}}</b-td>
                            </b-tr>
                        </b-tbody>
                    </b-table-simple>
                </b-card>
            </b-card-group>
        </div>
        </div> 
        <h1 style="margin-left: 15px;margin-top: 10px"><b-badge class="badge">执行节点：{{this.sAgentInfoList.length}} 个</b-badge></h1>
        <div class="dbox">
        <div style="margin-left: 15px">
            <b-card-group deck>
                <b-card
                        no-body
                        style="max-width: 16rem;min-width: 16rem"
                        border-variant="primary"
                        v-for="item in sAgentInfoList"
                        class="text-center mt-1">
                    <b-list-group flush>
                        <b-list-group-item variant="info">{{item.agentName}}</b-list-group-item>
                        <b-list-group-item  variant="warning">{{item.agentUrl}}</b-list-group-item>
                        <b-list-group-item v-if="item.agentState == 'R'" variant="success">状态：正常</b-list-group-item>
                        <b-list-group-item v-if="item.agentState != 'R'"  variant="danger">状态：异常</b-list-group-item>
                    </b-list-group>
                </b-card>
            </b-card-group>
        </div>
        </div>
    </div>
</div>
<div class="footerPage"></div>
</body>
</html>
